1. Field of the Invention
The present invention relates to a memory system including a nonvolatile semiconductor memory.
2. Description of the Related Art
The SSD includes a plurality of flash memory chips, a controller that performs read/write control for the respective flash memory chips in response to a request from a host apparatus, a buffer memory for performing data transfer between the respective flash memory chips and the host apparatus, a power supply circuit, and a connection interface to the host apparatus (for example, Japanese Patent No. 3688835).
Examples of the nonvolatile semiconductor memory include nonvolatile semiconductor memories in which a unit of erasing, writing, and readout is fixed such as a nonvolatile semiconductor memory that, in storing data, once erases the data in block units and then performs writing and a nonvolatile semiconductor memory that performs writing and readout in page units in the same manner as the NAND-type flash memory.
On the other hand, a unit for a host apparatus such as a personal computer to write data in and read out the data from a secondary storage device such as a hard disk is called sector. The sector is set independently from a unit of erasing, writing, and readout of a semiconductor storage device.
For example, whereas a size of a block (a block size) of the nonvolatile semiconductor memory is 512 kB and a size of a page (a page size) thereof is 4 kB, a size of a sector (a sector size) of the host apparatus is set to 512 B.
In this way, the unit of erasing, writing, and readout of the nonvolatile semiconductor memory may be larger than the unit of writing and readout of the host apparatus.
Therefore, when the secondary storage device of the personal computer such as the hard disk is configured by using the nonvolatile semiconductor memory, it is necessary to write data with a small size from the personal computer as the host apparatus by adapting the size to the block size and the page size of the nonvolatile semiconductor memory.
The data recorded by the host apparatus such as the personal computer has both temporal locality and spatial locality (see, for example, David A. Patterson and John L. Hennessy, “Computer Organization and Design: The Hardware/Software Interface”, Morgan Kaufmann Publishers, Aug. 31, 2004). Therefore, when data is recorded, if the data is directly recorded in an address designated from the outside, rewriting, i.e., erasing processing temporally concentrates in a specific area and a bias in the number of times of erasing increases. Therefore, in the NAND-type flash memory, processing called wear leveling for equally distributing data update sections is performed.
In the wear leveling processing, for example, a logical address designated by the host apparatus is translated into a physical address of the nonvolatile semiconductor memory in which the data update sections are equally distributed.
When a large-capacity secondary storage device is configured by using the NAND flash memory, in performing the address translation, if a unit of the data management is a small size (e.g., the page size), the size of management tables increases and does not fit in a main memory of a controller of the secondary storage device. Address translation cannot be performed at high speed. In this way, the size of the management tables inevitably increases according to an increase in capacity of the NAND flash memory as the secondary storage device. Therefore, there is a demand for a method of reducing a capacity of the management tables as much as possible.
As explained above, when a data erasing unit (a block) and a data management unit are different, according to the progress of rewriting of the flash memory, blocks are made porous by invalid (non-latest) data. When the blocks in such a porous state increases, substantially usable blocks decrease and a storage area of the flash memory cannot be effectively used. Therefore, processing called compaction for collecting valid latest data and rewriting the data in different blocks is performed. The compaction processing may take a long time, depending on the method being used. Thus, a method for shortening the compaction processing time is in demand.
Also, with regard to deterioration of the cells in a flash memory, one of the important factors is the amount of data that needs to be erased from the blocks in the flash memory in relation to the amount of data that is written to the flash memory from the host apparatus side. The amount of data erased from the blocks in relation to the amount of data written to the flash memory from the host apparatus represents writing efficiency. The smaller a writing efficiency value is, the higher is the writing efficiency. Generally speaking, in NAND-type flash memories, a lot of time is spent on the processes to erase data from the blocks and to write data into the blocks. Thus, when the writing efficiency is low, it means that the amount of data erased from the blocks and the amount of data written to the erased blocks are large, in relation to the amount of data written to the flash memory from the host apparatus. It also means that the speed performance of the flash memory is lowered. As explained here, a method for improving the writing efficiency by keeping the amount of data written to a flash memory closer to the amount of data erased from the blocks is also in demand.
To achieve the objects described above, a technique has been disclosed by which another block called a “log block” is kept in correspondence with each of the blocks in which data is stored (i.e., data blocks) (see, for example, Japanese Patent Application Laid-open No. 2002-366423). According to this technique, to improve the writing efficiency, data is written into free pages within the log block so that when the log block no longer has a free page or when there is not enough log block area, the data stored in the log block is reflected into the data block (i.e., merge processing).
However, one of the problems with this technique is that, because the data blocks and the log blocks are provided in a one-to-one correspondence, the number of blocks that can be updated at the same time is limited to the number of log blocks. In other words, when data having a small size is written into each of a large number of blocks, the merge processing is performed while the log blocks still have many free pages. As a result, the writing efficiency cannot be improved.